import {
  todayStatCount,

  todayStatCountForXBeauty,
} from '../../services/channel/api';


export default {
  namespace: 'loanStatistics',

  state: {

    loading: true,

  },

  effects: {

    *fetchTodayStatCount({payload,callback}, { call, put }) {
      const response = yield call(todayStatCount,payload);
      if (response && response.code == 200) {
        yield put({
          type: 'save',
          payload: {todayData: response.data},
        });
        if (callback) callback();
      }
    },

    //想美
    *fetchTodayStatCountForXBeauty({payload, callback}, { call, put }) {
      const response = yield call(todayStatCountForXBeauty, payload);
      if (response && response.code == 200) {
        yield put({
          type: 'save',
          payload: {todayData: response.data},
        });
        if (callback) callback();
      }
    },

  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },

};
